﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using BLL;
using DAL;

namespace Utility
{
    /// <summary>
    /// Define RepositoryFactory
    /// </summary>
    public class RepositoryFactory
    {
        public static T SearchTnfo<T>()
        {
            T repositoryObject = default(T);
            
            if (typeof(T) == typeof(IAuthorityRepository))
            {
                IAuthorityRepository tempRepository = (IAuthorityRepository)new DAL.AuthorityRepository();
                repositoryObject = (T)tempRepository;
            }

            if (typeof(T) == typeof(IRoleRepository))
            {
                IRoleRepository tempRepository = (IRoleRepository)new DAL.RoleRepository();
                repositoryObject = (T)tempRepository;
            }

            if (typeof(T) == typeof(IUserRepository))
            {
                IUserRepository tempRepository = (IUserRepository)new DAL.UserRepository();
                repositoryObject = (T)tempRepository;
            }
            

            return repositoryObject;
        }
    }
}
